"use strict"

//使用本地化
import {useGlobalConf} from '@/utils/useGlobalConf'
import {zhCN as customizedZhCN, enUS as customizedEnUS} from '@/locales/index.mjs'
import {zhCN, dateZhCN, enUS, dateEnUS, createLocale} from 'naive-ui'
const {globalConf} = useGlobalConf()
const customizedZhCNLocale = createLocale(customizedZhCN, zhCN)
const customizedEnUSLocale = createLocale(customizedEnUS, enUS)
const i18nStructure = {
    'zh-CN': {locale: customizedZhCNLocale, 'date-locale': dateZhCN},
    'en-US': {locale: customizedEnUSLocale, 'date-locale': dateEnUS}
}

export const locale = computed(() => i18nStructure[globalConf.appLanguageI18n]['locale'])
export const dateLocale = computed(() => i18nStructure[globalConf.appLanguageI18n]['date-locale'])
export const useLocale = (type) => {
    return computed(() => locale.value.myLocales[type])
}